<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use \App\Admin\Manager;
use Auth;
use Illuminate\Support\Facades\DB;

class IndexController extends Controller
{
    public function index()
    {

        return view('admin.index.index');
    }
    public function welcome()
    {
        $auth=\App\Admin\Auth::get();
        foreach($auth as $val){
            if($val->pid==0){
                $val->pid='顶级权限';
            }else{
                $val->pid=$val->Auth->auth_name;
            }
        }
        $manager_count = Manager::count();
        $role_count=DB::table('role')->count();
        $auth_count=DB::table('auth')->count();
        return view('admin.index.welcome',compact(
            'auth','manager_count','role_count','auth_count'));
    }
    public function info()
    {
        $id=Auth::guard('admin')->user()->id;
        $data=Manager::where('id',$id)->get();
        //  dd($data);
        return view('admin.index.info',compact('data'));
    }
    public function dashboard()
    {
        return view('admin.index.dashboard');
    }

}
